<?php

namespace App\Console\Commands;

use App\OrderPay;
use App\Repositories\OrderRespository;
use App\User;
use Illuminate\Console\Command;

class TeamHanle extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'team:handle {order_pay_id}';
    protected  $order_pay_id;
    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '给一个已支付的订单，根据绑定关心重新生成佣金';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();

    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->info('开始');
        $order_pay_id = $this->argument('order_pay_id');
       $order_pay= OrderPay::find($order_pay_id);
       $orderRespository=new OrderRespository();
       $orderRespository->teamHandle(User::find($order_pay->user_id),$order_pay);
       $this->info('结束');

    }
}
